negotiator
Class BidHistory

java.lang.Object
  extended by negotiator.BidHistory

public class BidHistory
extends java.lang.Object

This class contains the bidding history of a negotiation agent.

Author:
Alex Dirkzwager, Mark Hendrikx, Tim Baarslag

Constructor Summary
BidHistory()
          Creates an empty bid history.
BidHistory(java.util.List<BidDetails> bids)
          Creates a bid history given an array of bids offered by the negotiation agent.
 
Method Summary
 void add(BidDetails bid)
          Add an offered bid o the history.
 BidHistory discountedFilterBetween(double minU, double maxU, double minT, double maxT, UtilitySpace utilSpace)
          Returns the set of bids offered between time instances t1 and t2: (t1, t2] and with a utility in (u1, u2].
 BidHistory filterBetween(double minU, double maxU, double minT, double maxT)
          Returns the set of bids offered between time instances t1 and t2: (t1, t2] and with a utility in (u1, u2].
 BidHistory filterBetweenTime(double t1, double t2)
          Returns the set of bids offered between time instances t1 and t2: (t1, t2].
 BidHistory filterBetweenUtility(double minU, double maxU)
          Returns the set of bids with a utility of at least u1 and at most u2: (u1, u2].
 BidHistory filterUtility(double u)
          Returns the set of bids with utility u.
 double getAverageDiscountedUtility(UtilitySpace utilSpace)
           
 double getAverageUtility()
           
 BidDetails getBestBidDetails()
          Returns the bid with the highest utility stored in the history.
 BidDetails getBestDiscountedBidDetails(UtilitySpace util)
          Returns the bid with the highest discounted utility stored in the history.
 BidDetails getFirstBidDetails()
          Returns the first bid stored in the history
 java.util.List<BidDetails> getHistory()
          Returns the full history.
 Bid getLastBid()
          Returns the last bid added to the history.
 BidDetails getLastBidDetails()
          Returns the last bid details added to the history.
 java.util.List<BidDetails> getNBestBids(int count)
          Returns a list of the top N bids which the opponent has offered.
 BidDetails getRandom()
           
 BidDetails getRandom(java.util.Random rand)
           
 BidDetails getWorstBidDetails()
          Returns the bid with the lowest utility stored in the history.
 boolean isEmpty()
          Checks if BidHistory (array) is empty or not.
 int size()
           
 BidHistory sortToTime()
          Sorts the bids contained in this BidHistory object on time.
 BidHistory sortToUtility()
          Sorts the bids contained in this BidHistory object on utility.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BidHistory

public BidHistory(java.util.List<BidDetails> bids)
Creates a bid history given an array of bids offered by the negotiation agent.

Parameters:
bids -

BidHistory

public BidHistory()
Creates an empty bid history.

Method Detail

filterBetweenTime

public BidHistory filterBetweenTime(double t1,
                                    double t2)
Returns the set of bids offered between time instances t1 and t2: (t1, t2].

Parameters:
t1 -
t2 -
Returns:
bids done in (t1, t2]

filterBetweenUtility

public BidHistory filterBetweenUtility(double minU,
                                       double maxU)
Returns the set of bids with a utility of at least u1 and at most u2: (u1, u2]. If u1 = u2, then it returns all bids with utility u1.

Parameters:
minU - minimum utility.
maxU - maximum utility.
Returns:
bids with a utility in (u1, u2]

filterBetween

public BidHistory filterBetween(double minU,
                                double maxU,
                                double minT,
                                double maxT)
Returns the set of bids offered between time instances t1 and t2: (t1, t2] and with a utility in (u1, u2].

Parameters:
minU - minimum utility.
maxU - maximum utility.
minT - minimum time.
maxT - maximum time.
Returns:
bids with utility (minU, maxU] made in the time (minT, maxT].

filterUtility

public BidHistory filterUtility(double u)
Returns the set of bids with utility u.

Parameters:
u - utility.
Returns:
set of bids with utility u.

discountedFilterBetween

public BidHistory discountedFilterBetween(double minU,
                                          double maxU,
                                          double minT,
                                          double maxT,
                                          UtilitySpace utilSpace)
Returns the set of bids offered between time instances t1 and t2: (t1, t2] and with a utility in (u1, u2].

Parameters:
minU - minimum discounted utility.
maxU - maximum discounted utility.
minT - minimum time.
maxT - maximum time.
utilSpace - preference profile used to find the discounted utility.
Returns:
bids with discounted utility (minU, maxU] made in the time (minT, maxT].

add

public void add(BidDetails bid)
Add an offered bid o the history.

Parameters:
bid - offered bid.

getHistory

public java.util.List<BidDetails> getHistory()
Returns the full history.

Returns:
history

getLastBidDetails

public BidDetails getLastBidDetails()
Returns the last bid details added to the history.

Returns:
last added bid details

getLastBid

public Bid getLastBid()
Returns the last bid added to the history.

Returns:
last added bid

getFirstBidDetails

public BidDetails getFirstBidDetails()
Returns the first bid stored in the history

Returns:
first bid of history

getBestBidDetails

public BidDetails getBestBidDetails()
Returns the bid with the highest utility stored in the history.

Returns:
bid with highest utility

getBestDiscountedBidDetails

public BidDetails getBestDiscountedBidDetails(UtilitySpace util)
Returns the bid with the highest discounted utility stored in the history.

Parameters:
util - preference profile used to determine the discounted utility of a bid.
Returns:
bid with highest utility

getWorstBidDetails

public BidDetails getWorstBidDetails()
Returns the bid with the lowest utility stored in the history.

Returns:
bid with lowest utility

getNBestBids

public java.util.List<BidDetails> getNBestBids(int count)
Returns a list of the top N bids which the opponent has offered.

Parameters:
count - amount of N best bids.
Returns:
a list of bids.

size

public int size()
Returns:
amount of bids stored.

getAverageUtility

public double getAverageUtility()
Returns:
average utility of bids stored.

getAverageDiscountedUtility

public double getAverageDiscountedUtility(UtilitySpace utilSpace)
Parameters:
utilSpace - preference profile used to determine the discounted utility of a bid.
Returns:
average discounted utility of bids stored.

sortToUtility

public BidHistory sortToUtility()
Sorts the bids contained in this BidHistory object on utility.

Returns:
sorted BidHistory.

sortToTime

public BidHistory sortToTime()
Sorts the bids contained in this BidHistory object on time.

Returns:
sorted BidHistory.

getRandom

public BidDetails getRandom()
Returns:
random bid from this BidHistory.

getRandom

public BidDetails getRandom(java.util.Random rand)
Parameters:
rand - random generator.
Returns:
random bid from this BidHistory using the given random generator.

isEmpty

public boolean isEmpty()
Checks if BidHistory (array) is empty or not.

Returns:
true if no bids are stored.